package com.java.base.exercise.current;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author RenPu
 * @Date 2021/9/11 16:02
 * @Version 1.0
 * @Description: 原子类的操作
 **/
public class AtomicIntegerTest {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(1);
        System.out.println(atomicInteger.get());
        for (int i = 0; i < 10; i++) {
            atomicInteger.getAndIncrement();
        }
//        System.out.println();
        System.out.println(atomicInteger.get());
        Double oo = -5.551115123125783E-17;

        BigDecimal bigDecimal = new BigDecimal(oo);
        BigDecimal bigDecimal1 = bigDecimal.setScale(2, RoundingMode.CEILING);
        double v = bigDecimal1.doubleValue();
        System.out.println("科学计数的结果：" + v);

    }


}
